package com.lyq.mr.partition;


import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class CustomPartitioner extends Partitioner<Text,PartitionBean> {
    @Override
    public int getPartition(Text text, PartitionBean partitionBean, int i) {
        int partition = 0;
//        String key = text.toString();
        String key = partitionBean.getAppkey();// 这个也可以作为分区器
        if (key.equals("kar")){
            partition= 0;
        }else if (key.equals("pandora")){
            partition = 1;
        }else {
            partition = 2;
        }


        return partition;

    }
}
